(function ($) {
	//加载表单
	  DataTable = function(){
	 	return {
	 		init: function () {
	 			var dutyTable = $('#stuServiceCenterInfo').dataTable({
	 				"bPaginate": true,  //是否显示分页
//	             	"iDisplayLength": 5,
	             	"bLengthChange": true,//每页显示的记录数
	             	"bFilter": false, //搜索栏
	             	"bSort": true, //是否支持排序功能
	             	"bInfo": true, //显示表格信息
	             	"bAutoWidth": false,  //自适应宽度
	             	"bStateSave": true, //保存状态到cookie *************** 很重要 ， 当搜索的时候页面一刷新会导致搜索的消失。使用这个属性就可避免了
	             	//"sPaginationType": "", //分页，一共两种样式，full_numbers和two_button(默认)
	             	"sAjaxSource" : ctx+'/consultInfoManage/load',
	         		"fnServerData": retrieveData,//用于替换默认发到服务端的请求操作  
	             	"bServerSide": true,
	             	"bDestroy": true,
	                 "bRetrieve": false,
	                 "oLanguage" : {
	                 	"sLengthMenu" : "每页显示 _MENU_ 条记录",
	         			"sZeroRecords" : "抱歉， 没有找到",
	         			"sInfo" : "从 _START_ 到 _END_ / 共 _TOTAL_ 条数据",
	         			"sInfoEmpty" : "找不到相关数据",
	         			"sInfoFiltered" : "数据表中共为 _MAX_ 条记录)",
	         			"sProcessing": "正在加载中...",
	         			"sSearch": "搜索",
	         			"oPaginate" : {
	         				"sFirst" : "首页",
	         				"sPrevious" : "前一页",
	         				"sNext" : "后一页",
	         				"sLast" : "尾页"
	         			},
	                 },
	                 "aoColumns" : [
                            {
    	                        "mData": "infoManageId", 'sClass': "text-center", "bSortable": false, "mRender": function (data, type, full) {
    	                        return '<label  class="labletab" style="padding-top: 0px"> <input name="ajaxcheckbox" type="checkbox" class="checkchild" > <span class="text" applyId=""></span> </label>';
    	                        }
    	                  },
	                        {"mData": "createDate", 'sClass': "text-center"},
	 						{"mData": "enable", 'sClass': "text-center"},
	 						{"mData": "departmentName1", 'sClass': "text-center"},
	 						{"mData": "studentName", 'sClass': "text-center"},
	 						{"mData": "studentPhone", 'sClass': "text-center"},
	 						{"mData": "studentSex", 'sClass': "text-center"},
	 						{"mData": "idcard", 'sClass': "text-center"},
	 						{"mData": "projectName", 'sClass': "text-center"},
	 						{"mData": "projectLevelName", 'sClass': "text-center"},
	 						{
	 			                "mData": "infoManageId",
	 			                'sClass': "text-center",
	 			                "bSortable": false,
	 			                "mRender": function (data, type, full ) {
	 			                	var u = "<a data-record='"+JSON.stringify(full)+"' class='btn btn-warning btn-xs ck' data-toggle='modal' data-target='.bphone'><i class='fa fa-folder-open-o'></i>查看</a>";
	 			                    var m = "<a data-record='"+JSON.stringify(full)+"' class='btn btn-xs btn-info' data-toggle='modal' data-target='.information' data-backdrop='static'><i class='fa fa-sign-out'></i> 发送信息</a>";
	 			                	var d = "<a data-record='"+JSON.stringify(full)+"' class='btn btn-xs btn-darkorange' data-toggle='modal' data-target='' data-backdrop='static'><i class='fa fa-download'></i> 下载</a>";
	 			                    return u+m+d;
	 			                }
	 			            }

	                 ],
	                 "aoColumnDefs": [{
	 	   	            sDefaultContent: '',
	 	   	            aTargets: ['_all']
	 	   	        }],
	 	   	    "fnRowCallback":function(nRow,aData,iDisplayIndex){
	 	   	    	$('td:eq(2)',nRow).html(aData.enable=='1'?'有效':'无效');
	 	   	    	$('td:eq(6)',nRow).html(aData.studentSex=='0'?'男':'女');
	 	   	    	return nRow;
	 	   	     }
	 			});
	 			//每页显示记录数
	 			$('.dataTables_info').parent().append($('.dataTables_length'));
	 		}
	 	}
	 }();
	 DataTable.init();
	 //查看 发送短信 下载
	 $('#stuServiceCenterInfo').on('click','a.btn-xs',function(){
		 var data = $(this).attr('data-record');
		 if($(this).hasClass('btn-warning')){
			 fillInfo(data);
		 }else if($(this).hasClass('btn-info')){
			 $('#sendShortMsg').attr('data-record',data);
			 fillShortMsg(data);
		 }else if($(this).hasClass('btn-darkorange')){
			 
		 }
	 });
	 function fillShortMsg(data){
		 data = JSON.parse(data);
		 $('#MsgForm select[name=departmentId1]').find('option').remove();
		 var opt = '<option value="'+data.departmentId1+'">'+data.departmentName1+'</option>';
		 $('#MsgForm select[name=departmentId1]').append(opt);
		 $('#studentPhoneMsg').val(data.studentPhone);
		 initSchoolArea(data);
	 }
	 function fillInfo(data){
		 data = JSON.parse(data);
		 var infoManageId = data.infoManageId;
		 $.ajax( { 
			 "url":  ctx + '/financeGroupIncome/getStuPayDeatil/'+infoManageId,  
 	         "cache": false,  
 	         "dataType": 'json', 
 	         "type": "POST", 
 	         "success" :function(data) {
 	        	 var consultInfo = data.consultInfo;
 	        	 var payInfoData = data.payInfoData;
 	        	 var project = data.project;
 	        	 fillStuBaseInfo(consultInfo);
 	        	 fillStuCourseInfo(consultInfo,project);
 	        	 fillStuZLLQInfo(consultInfo);
 	        	 if(project.projectType=='1'){
 	        		fillZYCoursePayInfo(consultInfo,payInfoData);
 	        	 }else{
 	        		fillXueLiCoursePayInfo(consultInfo,payInfoData);
 	        	 }
 	        	loadConsultRecord(consultInfo);
 	         } 
			 
		 }); 
 	         
	 }
	 
	 
	 //填写个人信息
	 function fillStuBaseInfo(consultInfo){
		 $('#scdata').find('input[name=studentName]').val(consultInfo.studentName);
		 $('#scdata').find('input[name=studentSex]').val(consultInfo.studentSex);
		 $('#scdata').find('input[name=age]').val(consultInfo.age);
		 $('#scdata').find('input[name=studentPhone]').val(consultInfo.studentPhone);
		 $('#scdata').find('input[name=email]').val(consultInfo.email);
		 $('#scdata').find('input[name=phoneBelong]').val(consultInfo.phoneBelong);  
		 $('#scdata').find('input[name=weChat]').val(consultInfo.weChat);
		 $('#scdata').find('input[name=tengXun]').val(consultInfo.tengXun);
		 $('#scdata').find('input[name=ortherPhone]').val(consultInfo.ortherPhone);
		 $('#scdata').find('select[name=idcardType]').val(consultInfo.idcardType); 
		 $('#scdata').find('select[name=idcard]').val(consultInfo.idcard);
		 $('#scdata').find('select[name=infoType]').val(consultInfo.infoType); 
		 $('#scdata').find('input[name=phoneAddress]').val(consultInfo.phoneAddress);
		 $('#scdata').find('input[name=workSpace]').val(consultInfo.workSpace);
	 }
	 //填写课程信息
	 function fillStuCourseInfo(consultInfo,project){
			$('#scdata').find('select[name=projectType]').find('option').remove();
        	var projectType="<option selected>"+(project?(project.projectType=='1'?'职业资格':'学历'):'')+"</option>";
        	$('#scdata').find('select[name=projectType]').append(projectType);
        	
        	$('#scdata').find('select[name=projectName]').find('option').remove();
        	var projectName = "<option value='"+(consultInfo.projectName)+"'selected>"+(consultInfo.projectName?consultInfo.projectName:'')+"</option>";
        	$('#scdata').find('select[name=projectName]').append(projectName);
        	
        	$('#scdata').find('select[name=projectLevelNname]').find('option').remove();
        	var projectLevelName= "<option value='"+consultInfo.projectLevelName+"'selected>"+(consultInfo.projectLevelName?consultInfo.projectLevelName:'')+"</option>";
        	$('#scdata').find('select[name=projectLevelNname]').append(projectLevelName);
        	
        	$('#scdata').find('select[name=kTime]').find('option').remove();
        	var kTime="<option value='"+consultInfo.kTime+"'selected>"+(consultInfo.kTimeValue?consultInfo.kTimeValue:'')+"</option>";
        	$('#scdata').find('select[name=kTime]').append(kTime);
        	
        	$('#scdata').find('select[name=classAttr]').find('option').remove();
        	var classAttr="<option value='"+consultInfo.classAttr+"'selected>"+(consultInfo.classAttr?consultInfo.classAttr:'')+"</option>";
        	$('#scdata').find('select[name=classAttr]').append(classAttr);
        	
        	$('#scdata').find('select[name=departmentName1]').find('option').remove();
        	var departmentName1="<option value='"+consultInfo.departmentName1+"'selected>"+(consultInfo.departmentName1?consultInfo.departmentName1:'')+"</option>";
        	$('#scdata').find('select[name=departmentName1]').append(departmentName1);
        	
        	$('#scdata').find('input[name=selfYH]').val(consultInfo.selfYH);
        	$('#scdata').find('input[name=ortherYH]').val(consultInfo.ortherYH);
        	$('#scdata').find('input[name=examRegion]').val(consultInfo.examRegion);
        	
	 }
	 //填写资料领取信息
	 function fillStuZLLQInfo(consultInfo){
		//资料领取
      	consultInfo.jcCk=='1'? $('#scdata input[name=jcCk]').prop('checked',true):$('#scdata input[name=jcCk]').prop('checked',false);
      	consultInfo.jfCk=='1'? $('#scdata input[name=jfCk]').prop('checked',true):$('#scdata input[name=jfCk]').prop('checked',false);
      	$('#scdata input[name=zlContent]').val(consultInfo.zlContent?consultInfo.zlContent:'');
        	
	 }
	 //缴费信息  定坐费算在培训费里  职业教育
	 	function fillZYCoursePayInfo(consultInfo,payInfoData){
	 		function payKind(){
	 			return {dz:0,px:0,xy:0,kw:0,jc:0,zl:0,fw:0};
	 		}
	 		$('#payMentTableInfo').html('');
	 		var payDZ=0,payPx=0,payKw=0,payZl=0,payXy=0,payJc=0,payFw=0,payY=0,payZk=0,coursePrice=0,totalPrice=0;
	 		$(payInfoData).each(function(i,item){
	 			payDZ+=parseFloat((item.payDZ?item.payDZ:0));
	 			payPx+=parseFloat((item.payPx?item.payPx:0));
	 			payKw+=parseFloat((item.payKw?item.payKw:0));
	 			payZl+=parseFloat((item.payZl?item.payZl:0));
	 			payXy+=parseFloat((item.payXy?item.payXy:0));
	 			payJc+=parseFloat((item.payJc?item.payJc:0));
	 			payFw+=parseFloat((item.payFw?item.payFw:0));
	 			payY+=parseFloat((item.payY?item.payY:0));
	 			payZk+=parseFloat((item.payS?item.payS:0));
	 		});
	 		payPx+=payDZ;//  定坐费算在培训费里
	 		totalPrice=parseFloat(payDZ+payPx+payKw+payZl+payXy+payJc+payFw);
	 		coursePrice=parseFloat(totalPrice-payY-payZk);//课程价格、实缴
	 		$('#scdata').find('input[name=coursePrice]').val(coursePrice);
	 		$('#scdata').find('input[name=youhui]').val(payY);
	 		var dzsjArr = new Array(),pxsjArr=new Array(),xysjArr=new Array();//记录每次实缴
	 		var kwsjArr = new Array(),jcsjArr=new Array(),zlsjArr=new Array(),fwsjArr= new Array();
	 		$(payInfoData).each(function(i,item){
	 			//定坐费
	 			var dzsj=(parseFloat((item.payDzXj?item.payDzXj:0))+parseFloat((item.payDzZp?item.payDzZp:0))+parseFloat((item.payDzSk?item.payDzSk:0))
	 	 				 +(parseFloat(item.payDzWeixin?item.payDzWeixin:0))+parseFloat((item.payDzZfb?item.payDzZfb:0))+parseFloat((item.payDzWl?item.payDzWl:0))
	 	 				 +(parseFloat(item.payDzZz?item.payDzZz:0))+(parseFloat(item.payDzFq?item.payDzFq:0)));
	 			dzsjArr.push(parseFloat(dzsj));
	 			//培训费
	 			var pxsj=((parseFloat(item.payPxXj?item.payPxXj:0))+(parseFloat(item.payPxZp?item.payPxZp:0))+(parseFloat(item.payPxSk?item.payPxSk:0))
		 				 +(parseFloat(item.payPxWeixin?item.payPxWeixin:0))+(parseFloat(item.payPxZfb?item.payPxZfb:0))+(parseFloat(item.payPxWl?item.payPxWl:0))
		 				 +(parseFloat(item.payPxZz?item.payPxZz:0))+(parseFloat(item.payPxFq?item.payPxFq:0)));
	 			pxsjArr.push(parseFloat(pxsj));
	 			//协议费
	 			var xysj=((parseFloat(item.payXyXj?item.payXyXj:0))+(parseFloat(item.payXyZp?item.payXyZp:0))+(parseFloat(item.payXySk?item.payXySk:0))
		 				 +(parseFloat(item.payXyWeixin?item.payXyWeixin:0))+(parseFloat(item.payXyZfb?item.payXyZfb:0))+(parseFloat(item.payXyWl?item.payXyWl:0))
		 				 +(parseFloat(item.payXyZz?item.payXyZz:0))+(parseFloat(item.payXyFq?item.payXyFq:0)));
				xysjArr.push(parseFloat(xysj));
				//服务费
	 			var fwsj=(parseFloat((item.payFwXj?item.payFwXj:0))+(parseFloat(item.payFwZp?item.payFwZp:0))+(parseFloat(item.payFwSk?item.payFwSk:0))
		 				 +(parseFloat(item.payFwWeixin?item.payFwWeixin:0))+(parseFloat(item.payFwZfb?item.payFwZfb:0))+(parseFloat(item.payFwWl?item.payFwWl:0))
		 				 +(parseFloat(item.payFwZz?item.payFwZz:0))+(parseFloat(item.payFwFq?item.payFwFq:0)));
				fwsjArr.push(parseFloat(fwsj));
				//教材费
	 			var jcsj=((parseFloat(item.payJcXj?item.payJcXj:0))+(parseFloat(item.payJcZp?item.payJcZp:0))+(parseFloat(item.payJcSk?item.payJcSk:0))
		 				 +(parseFloat(item.payJcWeixin?item.payJcWeixin:0))+(parseFloat(item.payJcZfb?item.payJcZfb:0))+(parseFloat(item.payJcWl?item.payJcWl:0))
		 				 +(parseFloat(item.payJcZz?item.payJcZz:0))+(parseFloat(item.payJcFq?item.payJcFq:0)));
				jcsjArr.push(parseFloat(jcsj));
				//资料费
	 			var zlsj=((parseFloat(item.payZlXj?item.payZlXj:0))+(parseFloat(item.payZlZp?item.payZlZp:0))+(parseFloat(item.payZlSk?item.payZlSk:0))
		 				 +(parseFloat(item.payZlWeixin?item.payZlWeixin:0))+(parseFloat(item.payZlZfb?item.payZlZfb:0))+(parseFloat(item.payZlWl?item.payZlWl:0))
		 				 +(parseFloat(item.payZlZz?item.payZlZz:0))+(parseFloat(item.payZlFq?item.payZlFq:0)));
	 			zlsjArr.push(parseFloat(zlsj));
				//考务费
	 			var kwsj=((parseFloat(item.payKwXj?item.payKwXj:0))+(parseFloat(item.payKwZp?item.payKwZp:0))+(parseFloat(item.payKwSk?item.payKwSk:0))
		 				 +(parseFloat(item.payKwWeixin?item.payKwWeixin:0))+(parseFloat(item.payKwZfb?item.payKwZfb:0))+(parseFloat(item.payKwWl?item.payKwWl:0))
		 				 +(parseFloat(item.payKwZz?item.payKwZz:0))+(parseFloat(item.payKwFq?item.payKwFq:0)));
				kwsjArr.push(parseFloat(kwsj));
	 		});
	 		//按不同缴费方式统计
	 		var xjKind = new payKind(),zpKind=new payKind(),skKind=new payKind(),weixinKind=new payKind();
	 		var wlKind = new payKind(),zfbKind = new payKind(),zzKind=new payKind(),fqKind = new payKind();
	 		$(payInfoData).each(function(i,item){
	 			xjKind.dz+=parseFloat((item.payDzXj?item.payDzXj:0));
	 			xjKind.px+=parseFloat((item.payPxXj?item.payPxXj:0));
	 			xjKind.xy+=parseFloat((item.payXyXj?item.payXyXj:0));
	 			xjKind.jc+=parseFloat((item.payJcXj?item.payJcXj:0));
	 			xjKind.fw+=parseFloat((item.payFwXj?item.payFwXj:0));
	 			xjKind.zl+=parseFloat((item.payZlXj?item.payZlXj:0));
	 			xjKind.kw+=parseFloat((item.payKwXj?item.payKwXj:0));
	 			
	 			zpKind.dz+=parseFloat((item.payDzZp?item.payDzZp:0));
	 			zpKind.px+=parseFloat((item.payPxZp?item.payPxZp:0));
	 			zpKind.xy+=parseFloat((item.payXyZp?item.payXyZp:0));
	 			zpKind.jc+=parseFloat((item.payJcZp?item.payJcZp:0));
	 			zpKind.fw+=parseFloat((item.payFwZp?item.payFwZp:0));
	 			zpKind.zl+=parseFloat((item.payZlZp?item.payZlZp:0));
	 			zpKind.kw+=parseFloat((item.payKwZp?item.payKwZp:0));
	 			
	 			skKind.dz+=parseFloat((item.payDzSk?item.payDzSk:0));
	 			skKind.px+=parseFloat((item.payPxSk?item.payPxSk:0));
	 			skKind.xy+=parseFloat((item.payXySk?item.payXySk:0));
	 			skKind.jc+=parseFloat((item.payJcSk?item.payJcSk:0));
	 			skKind.fw+=parseFloat((item.payFwSk?item.payFwSk:0));
	 			skKind.zl+=parseFloat((item.payZlSk?item.payZlSk:0));
	 			skKind.kw+=parseFloat((item.payKwSk?item.payKwSk:0));
	 			
	 			weixinKind.dz+=parseFloat((item.payDzWeixin?item.payDzWeixin:0));
	 			weixinKind.px+=parseFloat((item.payPxWeixin?item.payPxWeixin:0));
	 			weixinKind.xy+=parseFloat((item.payXyWeixin?item.payXyWeixin:0));
	 			weixinKind.jc+=parseFloat((item.payJcWeixin?item.payJcWeixin:0));
	 			weixinKind.fw+=parseFloat((item.payFwWeixin?item.payFwWeixin:0));
	 			weixinKind.zl+=parseFloat((item.payZlWeixin?item.payZlWeixin:0));
	 			weixinKind.kw+=parseFloat((item.payKwWeixin?item.payKwWeixin:0));
	 			
	 			wlKind.dz+=parseFloat((item.payDzWl?item.payDzWl:0));
	 			wlKind.px+=parseFloat((item.payPxWl?item.payPxWl:0));
	 			wlKind.xy+=parseFloat((item.payXyWl?item.payXyWl:0));
	 			wlKind.jc+=parseFloat((item.payJcWl?item.payJcWl:0));
	 			wlKind.fw+=parseFloat((item.payFwWl?item.payFwWl:0));
	 			wlKind.zl+=parseFloat((item.payZlWl?item.payZlWl:0));
	 			wlKind.kw+=parseFloat((item.payKwWl?item.payKwWl:0));
	 			
	 			zfbKind.dz+=parseFloat((item.payDzZfb?item.payDzZfb:0));
	 			zfbKind.px+=parseFloat((item.payPxZfb?item.payPxZfb:0));
	 			zfbKind.xy+=parseFloat((item.payXyZfb?item.payXyZfb:0));
	 			zfbKind.jc+=parseFloat((item.payJcZfb?item.payJcZfb:0));
	 			zfbKind.fw+=parseFloat((item.payFwZfb?item.payFwZfb:0));
	 			zfbKind.zl+=parseFloat((item.payZlZfb?item.payZlZfb:0));
	 			zfbKind.kw+=parseFloat((item.payKwZfb?item.payKwZfb:0));
	 			
	 			zzKind.dz+=parseFloat((item.payDzZz?item.payDzZz:0));
	 			zzKind.px+=parseFloat((item.payPxZz?item.payPxZz:0));
	 			zzKind.xy+=parseFloat((item.payXyZz?item.payXyZz:0));
	 			zzKind.jc+=parseFloat((item.payJcZz?item.payJcZz:0));
	 			zzKind.fw+=parseFloat((item.payFwZz?item.payFwZz:0));
	 			zzKind.zl+=parseFloat((item.payZlZz?item.payZlZz:0));
	 			zzKind.kw+=parseFloat((item.payKwZz?item.payKwZz:0));
	 			
	 			fqKind.dz+=parseFloat((item.payDzFq?item.payDzFq:0));
	 			fqKind.px+=parseFloat((item.payPxFq?item.payPxFq:0));
	 			fqKind.xy+=parseFloat((item.payXyFq?item.payXyFq:0));
	 			fqKind.jc+=parseFloat((item.payJcFq?item.payJcFq:0));
	 			fqKind.fw+=parseFloat((item.payFwFq?item.payFwFq:0));
	 			fqKind.zl+=parseFloat((item.payZlFq?item.payZlFq:0));
	 			fqKind.kw+=parseFloat((item.payKwFq?item.payKwFq:0));
	 			
	 			
	 		});
	 			
	 		
	 		var PXSj=0;
	 		$(pxsjArr).each(function(i,item){
	 			PXSj+=(item+dzsjArr[i]);
	 		});
	 		var PXTr = '<tr><td>培训费</td><td>'+(payPx)+'</td><td>'+PXSj+'</td>';
	 		PXTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		PXTr+='<option value="Xj-'+(xjKind.dz+xjKind.px)+'">现金</option>';
	 		PXTr+='<option value="Sk-'+(skKind.dz+skKind.px)+'">刷卡</option>';
	 		PXTr+='<option value="Zp-'+(zpKind.dz+zpKind.px)+'">支票</option>';
	 		PXTr+='<option value="Weixin-'+(weixinKind.dz+weixinKind.px)+'">汇款-微信</option>';
	 		PXTr+='<option value="Zfb-'+(zfbKind.dz+zfbKind.px)+'">汇款-支付宝</option>';
	 		PXTr+='<option value="Wl-'+(wlKind.dz+wlKind.px)+'">汇款-网络</option>';
	 		PXTr+='<option value="Zz-'+(zzKind.dz+zzKind.px)+'">银行转账</option>';
	 		PXTr+='<option value="Fq-'+(fqKind.dz+fqKind.px)+'">分期</option>';
	 		PXTr+='</select></div>';
	 		PXTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.dz+xjKind.px)+'"></div></div>';
	 		PXTr+='</td><td>'+(payPx-PXSj)+'</td></tr>';
	 		
	 		var KWSj=0;
	 		$(kwsjArr).each(function(i,item){
	 			KWSj+=(item);
	 		});
	 		var KWTr = '<tr><td>考务费</td><td>'+payKw+'</td><td>'+KWSj+'</td>';
	 		KWTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		KWTr+='<option value="Xj-'+(xjKind.kw)+'">现金</option>';
	 		KWTr+='<option value="Sk-'+(skKind.kw)+'">刷卡</option>';
	 		KWTr+='<option value="Zp-'+(zpKind.kw)+'">支票</option>';
	 		KWTr+='<option value="Weixin-'+(weixinKind.kw)+'">汇款-微信</option>';
	 		KWTr+='<option value="Zfb-'+(zfbKind.kw)+'">汇款-支付宝</option>';
	 		KWTr+='<option value="Wl-'+(wlKind.kw)+'">汇款-网络</option>';
	 		KWTr+='<option value="Zz-'+(zzKind.kw)+'">银行转账</option>';
	 		KWTr+='<option vlaue="Fq-'+(fqKind.kw)+'">分期</option>';
	 		KWTr+='</select></div>';
	 		KWTr+='<div class="col-sm-5"><input  disabled class="form-control"type="text" value="'+(xjKind.kw)+'"></div></div>';
	 		KWTr+='</td><td>'+(payKw-KWSj)+'</td></tr>'; 
	 		
	 		var ZLSj=0;
	 		$(zlsjArr).each(function(i,item){
	 			ZLSj+=(item);
	 		});
	 		var ZLTr = '<tr><td>资料费</td><td>'+payZl+'</td><td>'+ZLSj+'</td>';
	 		ZLTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		ZLTr+='<option value="Xj-'+(xjKind.zl)+'">现金</option>';
	 		ZLTr+='<option value="Sk-'+(skKind.zl)+'">刷卡</option>';
	 		ZLTr+='<option value="Zp-'+(zpKind.zl)+'">支票</option>';
	 		ZLTr+='<option value="Weixin-'+(weixinKind.zl)+'">汇款-微信</option>';
	 		ZLTr+='<option value="Zfb-'+(zfbKind.zl)+'">汇款-支付宝</option>';
	 		ZLTr+='<option value="Wl-'+(wlKind.zl)+'">汇款-网络</option>';
	 		ZLTr+='<option value="Zz-'+(zzKind.zl)+'">银行转账</option>';
	 		ZLTr+='<option value="Fq-'+(fqKind.zl)+'">分期</option>';
	 		ZLTr+='</select></div>';
	 		ZLTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.zl)+'"></div></div>';
	 		ZLTr+='</td><td>'+(payZl-ZLSj)+'</td></tr>'; 
	 		
	 		var XYSj=0;
	 		$(xysjArr).each(function(i,item){
	 			XYSj+=(item);
	 		});
	 		var XYTr = '<tr><td>协议费</td><td>'+payXy+'</td><td>'+XYSj+'</td>';
	 		XYTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		XYTr+='<option value="Xj-'+(xjKind.xy)+'">现金</option>';
	 		XYTr+='<option value="Sk-'+(skKind.xy)+'">刷卡</option>';
	 		XYTr+='<option value="Zp-'+(zpKind.xy)+'">支票</option>';
	 		XYTr+='<option value="Weixin-'+(weixinKind.xy)+'">汇款-微信</option>';
	 		XYTr+='<option value="Zfb-'+(zfbKind.xy)+'">汇款-支付宝</option>';
	 		XYTr+='<option value="Wl-'+(wlKind.xy)+'">汇款-网络</option>';
	 		XYTr+='<option value="Zz-'+(zzKind.xy)+'">银行转账</option>';
	 		XYTr+='<option value="Fq-'+(fqKind.xy)+'">分期</option>';
	 		XYTr+='</select></div>';
	 		XYTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.xy)+'"></div></div>';
	 		XYTr+='</td><td>'+(payXy-XYSj)+'</td></tr>';
	 		
	 		var JCSj=0;
	 		$(jcsjArr).each(function(i,item){
	 			JCSj+=(item);
	 		});
	 		var JCTr = '<tr><td>教材费</td><td>'+payJc+'</td><td>'+JCSj+'</td>';
	 		JCTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		JCTr+='<option value="Xj-'+(xjKind.jc)+'">现金</option>';
	 		JCTr+='<option value="Sk-'+(skKind.jc)+'">刷卡</option>';
	 		JCTr+='<option value="Zp-'+(zpKind.jc)+'">支票</option>';
	 		JCTr+='<option value="Weixin-'+(weixinKind.jc)+'">汇款-微信</option>';
	 		JCTr+='<option value="Zfb-'+(zfbKind.jc)+'">汇款-支付宝</option>';
	 		JCTr+='<option value="Wl-'+(wlKind.jc)+'">汇款-网络</option>';
	 		JCTr+='<option value="Zz-'+(zzKind.jc)+'">银行转账</option>';
	 		JCTr+='<option value="Fq-'+(fqKind.jc)+'">分期</option>';
	 		JCTr+='</select></div>';
	 		JCTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.jc)+'"></div></div>';
	 		JCTr+='</td><td>'+(payJc-JCSj)+'</td></tr>'; 
	 		
	 		var FWSj=0;
	 		$(fwsjArr).each(function(i,item){
	 			FWSj+=(item);
	 		});
	 		var FWTr = '<tr><td>服务费</td><td>'+payFw+'</td><td>'+FWSj+'</td>';
	 		FWTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		FWTr+='<option value="Xj-'+(xjKind.fw)+'">现金</option>';
	 		FWTr+='<option value="Sk-'+(skKind.fw)+'">刷卡</option>';
	 		FWTr+='<option value="Zp-'+(zpKind.fw)+'">支票</option>';
	 		FWTr+='<option value="Weixin-'+(weixinKind.fw)+'">汇款-微信</option>';
	 		FWTr+='<option value="Zfb-'+(zfbKind.fw)+'">汇款-支付宝</option>';
	 		FWTr+='<option value="Wl-'+(wlKind.fw)+'">汇款-网络</option>';
	 		FWTr+='<option value="Zz-'+(zzKind.fw)+'">银行转账</option>';
	 		FWTr+='<option value="Fq-'+(fqKind.fw)+'">分期</option>';
	 		FWTr+='</select></div>';
	 		FWTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.fw)+'"></div></div>';
	 		FWTr+='</td><td>'+(payFw-FWSj)+'</td></tr>'; 
	 		
	 		var ZJTr = '<tr><td>总计</td><td>'+(payPx+payKw+payZl+payXy+payJc+payFw)+'</td>';
	 		ZJTr+='<td>'+(PXSj+KWSj+ZLSj+XYSj+JCSj+FWSj)+'</td><td></td><td></td></tr>';
	 		var YHTr='<tr><td>优惠券</td><td>'+payY+'</td><td></td><td></td><td></td></tr>';
	 		var ZKTr='<tr><td>折扣</td><td>'+payZk+'</td><td></td><td></td><td></td></tr>';
	 		var HJTr = '<tr><td>合计</td><td>'+(payPx+payKw+payZl+payXy+payJc+payFw-payY-payZk)+'</td>';
	 		HJTr+='<td>'+(PXSj+KWSj+ZLSj+XYSj+JCSj+FWSj)+'</td><td></td>';
	 		HJTr+='<td>'+(payPx+payKw+payZl+payXy+payJc+payFw-payY-payZk-PXSj-KWSj-ZLSj-XYSj-JCSj-FWSj)+'</td></tr>';
	 		var thead='<thead><tr><th>收费项目</th><th>应缴</th><th>实缴</th><th>支付方式</th><th>欠费</th></tr></thead>';
	 		$('#payMentTableInfo').append(thead+PXTr+KWTr+ZLTr+XYTr+JCTr+FWTr+ZJTr+YHTr+ZKTr+HJTr);
	 	}
	 	
		 //缴费信息  定坐费算在培训费里    学历
	 	function fillXueLiCoursePayInfo(consultInfo,payInfoData){
	 		function payKind(){
	 			return {dz:0,xz:0,ks:0,zl:0,jc:0,dg:0};
	 		}
	 		$('#payMentTableInfo').html('');
	 		var payDZ=0,payXz=0,payKs=0,payZl=0,payJc=0,payDg=0,payFd=0,payY=0,payZk=0,coursePrice=0,totalPrice=0;
	 		$(payInfoData).each(function(i,item){
	 			payDZ+=parseFloat((item.payDZ?item.payDZ:0));
	 			payXz+=parseFloat((item.payPx?item.payPx:0));
	 			payKs+=parseFloat((item.payKw?item.payKw:0));
	 			payZl+=parseFloat((item.payZl?item.payZl:0));
	 			payJc+=parseFloat((item.payXy?item.payXy:0));
	 			payDg+=parseFloat((item.payJc?item.payJc:0));
	 			payFd+=parseFloat((item.payType?item.payType:0));
	 			payY+=parseFloat((item.payY?item.payY:0));
	 			payZk+=parseFloat((item.payS?item.payS:0));
	 		});
	 		payXz+=payDZ;//  定坐费算在培训费里
	 		totalPrice=parseFloat(payDZ+payXz+payKs+payZl+payJc+payDg+payFd);
	 		coursePrice=parseFloat(totalPrice-payY-payZk);//课程价格、应缴
	 		$('#scdata').find('input[name=coursePrice]').val(coursePrice);
	 		$('#scdata').find('input[name=youhui]').val(payY);
	 		var dzsjArr = new Array(),xzsjArr=new Array(),kssjArr=new Array();//记录每次实缴
	 		var zlsjArr = new Array(),jcsjArr=new Array(),dgsjArr=new Array();
	 		$(payInfoData).each(function(i,item){
	 			//定坐费
	 			var dzsj=(parseFloat((item.payDzXj?item.payDzXj:0))+parseFloat((item.payDzZp?item.payDzZp:0))+parseFloat((item.payDzSk?item.payDzSk:0))
	 	 				 +(parseFloat(item.payDzWeixin?item.payDzWeixin:0))+parseFloat((item.payDzZfb?item.payDzZfb:0))+parseFloat((item.payDzWl?item.payDzWl:0))
	 	 				 +(parseFloat(item.payDzZz?item.payDzZz:0))+(parseFloat(item.payDzFq?item.payDzFq:0)));
	 			dzsjArr.push(parseFloat(dzsj));
	 			//学杂费
	 			var xzsj=((parseFloat(item.payPxXj?item.payPxXj:0))+(parseFloat(item.payPxZp?item.payPxZp:0))+(parseFloat(item.payPxSk?item.payPxSk:0))
		 				 +(parseFloat(item.payPxWeixin?item.payPxWeixin:0))+(parseFloat(item.payPxZfb?item.payPxZfb:0))+(parseFloat(item.payPxWl?item.payPxWl:0))
		 				 +(parseFloat(item.payPxZz?item.payPxZz:0))+(parseFloat(item.payPxFq?item.payPxFq:0)));
	 			xzsjArr.push(parseFloat(xzsj));
	 			//考试费
	 			var kssj=((parseFloat(item.payKwXj?item.payKwXj:0))+(parseFloat(item.payKwZp?item.payKwZp:0))+(parseFloat(item.payKwSk?item.payKwSk:0))
		 				 +(parseFloat(item.payKwWeixin?item.payKwWeixin:0))+(parseFloat(item.payKwZfb?item.payKwZfb:0))+(parseFloat(item.payKwWl?item.payKwWl:0))
		 				 +(parseFloat(item.payKwZz?item.payKwZz:0))+(parseFloat(item.payKwFq?item.payKwFq:0)));
	 			kssjArr.push(parseFloat(kssj));
	 			//资料费
	 			var zlsj=((parseFloat(item.payZlXj?item.payZlXj:0))+(parseFloat(item.payZlZp?item.payZlZp:0))+(parseFloat(item.payZlSk?item.payZlSk:0))
		 				 +(parseFloat(item.payZlWeixin?item.payZlWeixin:0))+(parseFloat(item.payZlZfb?item.payZlZfb:0))+(parseFloat(item.payZlWl?item.payZlWl:0))
		 				 +(parseFloat(item.payZlZz?item.payZlZz:0))+(parseFloat(item.payZlFq?item.payZlFq:0)));
	 			zlsjArr.push(parseFloat(zlsj));
	 			//教材费
	 			var jcsj=((parseFloat(item.payXyXj?item.payXyXj:0))+(parseFloat(item.payXyZp?item.payXyZp:0))+(parseFloat(item.payXySk?item.payXySk:0))
		 				 +(parseFloat(item.payXyWeixin?item.payXyWeixin:0))+(parseFloat(item.payXyZfb?item.payXyZfb:0))+(parseFloat(item.payXyWl?item.payXyWl:0))
		 				 +(parseFloat(item.payXyZz?item.payXyZz:0))+(parseFloat(item.payXyFq?item.payXyFq:0)));
	 			jcsjArr.push(parseFloat(jcsj));
				//代管费
	 			var dgsj=((parseFloat(item.payJcXj?item.payJcXj:0))+(parseFloat(item.payJcZp?item.payJcZp:0))+(parseFloat(item.payJcSk?item.payJcSk:0))
		 				 +(parseFloat(item.payJcWeixin?item.payJcWeixin:0))+(parseFloat(item.payJcZfb?item.payJcZfb:0))+(parseFloat(item.payJcWl?item.payJcWl:0))
		 				 +(parseFloat(item.payJcZz?item.payJcZz:0))+(parseFloat(item.payJcFq?item.payJcFq:0)));
	 			dgsjArr.push(parseFloat(dgsj));
				
	 		});
	 		//按不同缴费方式统计
	 		var xjKind = new payKind(),zpKind=new payKind(),skKind=new payKind(),weixinKind=new payKind();
	 		var wlKind = new payKind(),zfbKind = new payKind(),zzKind=new payKind(),fqKind = new payKind();
	 		$(payInfoData).each(function(i,item){
	 			xjKind.dz+=parseFloat((item.payDzXj?item.payDzXj:0));
	 			xjKind.xz+=parseFloat((item.payPxXj?item.payPxXj:0));
	 			xjKind.dg+=parseFloat((item.payJcXj?item.payJcXj:0));
	 			xjKind.jc+=parseFloat((item.payXyXj?item.payXyXj:0));
	 			xjKind.zl+=parseFloat((item.payZlXj?item.payZlXj:0));
	 			xjKind.ks+=parseFloat((item.payKwXj?item.payKwXj:0));
	 			
	 			zpKind.dz+=parseFloat((item.payDzZp?item.payDzZp:0));
	 			zpKind.xz+=parseFloat((item.payPxZp?item.payPxZp:0));
	 			zpKind.dg+=parseFloat((item.payJcZp?item.payJcZp:0));
	 			zpKind.jc+=parseFloat((item.payXyZp?item.payXyZp:0));
	 			zpKind.zl+=parseFloat((item.payZlZp?item.payZlZp:0));
	 			zpKind.ks+=parseFloat((item.payKwZp?item.payKwZp:0));
	 			
	 			skKind.dz+=parseFloat((item.payDzSk?item.payDzSk:0));
	 			skKind.xz+=parseFloat((item.payPxSk?item.payPxSk:0));
	 			skKind.dg+=parseFloat((item.payJcSk?item.payJcSk:0));
	 			skKind.jc+=parseFloat((item.payXySk?item.payXySk:0));
	 			skKind.zl+=parseFloat((item.payZlSk?item.payZlSk:0));
	 			skKind.ks+=parseFloat((item.payKwSk?item.payKwSk:0));
	 			
	 			weixinKind.dz+=parseFloat((item.payDzWeixin?item.payDzWeixin:0));
	 			weixinKind.xz+=parseFloat((item.payPxWeixin?item.payPxWeixin:0));
	 			weixinKind.dg+=parseFloat((item.payJcWeixin?item.payJcWeixin:0));
	 			weixinKind.jc+=parseFloat((item.payXyWeixin?item.payXyWeixin:0));
	 			weixinKind.zl+=parseFloat((item.payZlWeixin?item.payZlWeixin:0));
	 			weixinKind.ks+=parseFloat((item.payKwWeixin?item.payKwWeixin:0));
	 			
	 			wlKind.dz+=parseFloat((item.payDzWl?item.payDzWl:0));
	 			wlKind.xz+=parseFloat((item.payPxWl?item.payPxWl:0));
	 			wlKind.dg+=parseFloat((item.payJcWl?item.payJcWl:0));
	 			wlKind.jc+=parseFloat((item.payXyWl?item.payXyWl:0));
	 			wlKind.zl+=parseFloat((item.payZlWl?item.payZlWl:0));
	 			wlKind.ks+=parseFloat((item.payKwWl?item.payKwWl:0));
	 			
	 			zfbKind.dz+=parseFloat((item.payDzZfb?item.payDzZfb:0));
	 			zfbKind.xz+=parseFloat((item.payPxZfb?item.payPxZfb:0));
	 			zfbKind.dg+=parseFloat((item.payJcZfb?item.payJcZfb:0));
	 			zfbKind.jc+=parseFloat((item.payXyZfb?item.payXyZfb:0));
	 			zfbKind.zl+=parseFloat((item.payZlZfb?item.payZlZfb:0));
	 			zfbKind.ks+=parseFloat((item.payKwZfb?item.payKwZfb:0));
	 			
	 			zzKind.dz+=parseFloat((item.payDzZz?item.payDzZz:0));
	 			zzKind.xz+=parseFloat((item.payPxZz?item.payPxZz:0));
	 			zzKind.dg+=parseFloat((item.payJcZz?item.payJcZz:0));
	 			zzKind.jc+=parseFloat((item.payXyZz?item.payXyZz:0));
	 			zzKind.zl+=parseFloat((item.payZlZz?item.payZlZz:0));
	 			zzKind.ks+=parseFloat((item.payKwZz?item.payKwZz:0));
	 			
	 			fqKind.dz+=parseFloat((item.payDzFq?item.payDzFq:0));
	 			fqKind.xz+=parseFloat((item.payPxFq?item.payPxFq:0));
	 			fqKind.dg+=parseFloat((item.payJcFq?item.payJcFq:0));
	 			fqKind.jc+=parseFloat((item.payXyFq?item.payXyFq:0));
	 			fqKind.zl+=parseFloat((item.payZlFq?item.payZlFq:0));
	 			fqKind.ks+=parseFloat((item.payKwFq?item.payKwFq:0));
	 			
	 		});
	 			
	 		var XZSj=0;
	 		$(xzsjArr).each(function(i,item){
	 			XZSj+=(item+dzsjArr[i]);
	 		});
	 		var XZTr = '<tr><td>学杂费</td><td>'+(payXz)+'</td><td>'+XZSj+'</td>';
	 		XZTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		XZTr+='<option value="Xj-'+(xjKind.dz+xjKind.xz)+'">现金</option>';
	 		XZTr+='<option value="Sk-'+(skKind.dz+skKind.xz)+'">刷卡</option>';
	 		XZTr+='<option value="Zp-'+(zpKind.dz+zpKind.xz)+'">支票</option>';
	 		XZTr+='<option value="Weixin-'+(weixinKind.dz+weixinKind.xz)+'">汇款-微信</option>';
	 		XZTr+='<option value="Zfb-'+(zfbKind.dz+zfbKind.xz)+'">汇款-支付宝</option>';
	 		XZTr+='<option value="Wl-'+(wlKind.dz+wlKind.xz)+'">汇款-网络</option>';
	 		XZTr+='<option value="Zz-'+(zzKind.dz+zzKind.xz)+'">银行转账</option>';
	 		XZTr+='<option value="Fq-'+(fqKind.dz+fqKind.xz)+'">分期</option>';
	 		XZTr+='</select></div>';
	 		XZTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.dz+xjKind.xz)+'"></div></div>';
	 		XZTr+='</td><td>'+(payXz-XZSj)+'</td></tr>';
	 		
	 		var KSSj=0;
	 		$(kssjArr).each(function(i,item){
	 			KSSj+=(item);
	 		});
	 		var KSTr = '<tr><td>考试费</td><td>'+payKs+'</td><td>'+KSSj+'</td>';
	 		KSTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		KSTr+='<option value="Xj-'+(xjKind.ks)+'">现金</option>';
	 		KSTr+='<option value="Sk-'+(skKind.ks)+'">刷卡</option>';
	 		KSTr+='<option value="Zp-'+(zpKind.ks)+'">支票</option>';
	 		KSTr+='<option value="Weixin-'+(weixinKind.ks)+'">汇款-微信</option>';
	 		KSTr+='<option value="Zfb-'+(zfbKind.ks)+'">汇款-支付宝</option>';
	 		KSTr+='<option value="Wl-'+(wlKind.ks)+'">汇款-网络</option>';
	 		KSTr+='<option value="Zz-'+(zzKind.ks)+'">银行转账</option>';
	 		KSTr+='<option vlaue="Fq-'+(fqKind.ks)+'">分期</option>';
	 		KSTr+='</select></div>';
	 		KSTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.ks)+'"></div></div>';
	 		KSTr+='</td><td>'+(payKs-KSSj)+'</td></tr>'; 
	 		
	 		var ZLSj=0;
	 		$(zlsjArr).each(function(i,item){
	 			ZLSj+=(item);
	 		});
	 		var ZLTr = '<tr><td>资料费</td><td>'+payZl+'</td><td>'+ZLSj+'</td>';
	 		ZLTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		ZLTr+='<option value="Xj-'+(xjKind.zl)+'">现金</option>';
	 		ZLTr+='<option value="Sk-'+(skKind.zl)+'">刷卡</option>';
	 		ZLTr+='<option value="Zp-'+(zpKind.zl)+'">支票</option>';
	 		ZLTr+='<option value="Weixin-'+(weixinKind.zl)+'">汇款-微信</option>';
	 		ZLTr+='<option value="Zfb-'+(zfbKind.zl)+'">汇款-支付宝</option>';
	 		ZLTr+='<option value="Wl-'+(wlKind.zl)+'">汇款-网络</option>';
	 		ZLTr+='<option value="Zz-'+(zzKind.zl)+'">银行转账</option>';
	 		ZLTr+='<option value="Fq-'+(fqKind.zl)+'">分期</option>';
	 		ZLTr+='</select></div>';
	 		ZLTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.zl)+'"></div></div>';
	 		ZLTr+='</td><td>'+(payZl-ZLSj)+'</td></tr>'; 
	 		
	 		var JCSj=0;
	 		$(jcsjArr).each(function(i,item){
	 			JCSj+=(item);
	 		});
	 		var JCTr = '<tr><td>教材费</td><td>'+payJc+'</td><td>'+JCSj+'</td>';
	 		JCTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		JCTr+='<option value="Xj-'+(xjKind.jc)+'">现金</option>';
	 		JCTr+='<option value="Sk-'+(skKind.jc)+'">刷卡</option>';
	 		JCTr+='<option value="Zp-'+(zpKind.jc)+'">支票</option>';
	 		JCTr+='<option value="Weixin-'+(weixinKind.jc)+'">汇款-微信</option>';
	 		JCTr+='<option value="Zfb-'+(zfbKind.jc)+'">汇款-支付宝</option>';
	 		JCTr+='<option value="Wl-'+(wlKind.jc)+'">汇款-网络</option>';
	 		JCTr+='<option value="Zz-'+(zzKind.jc)+'">银行转账</option>';
	 		JCTr+='<option value="Fq-'+(fqKind.jc)+'">分期</option>';
	 		JCTr+='</select></div>';
	 		JCTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.jc)+'"></div></div>';
	 		JCTr+='</td><td>'+(payJc-JCSj)+'</td></tr>';
	 		
	 		var DGSj=0;
	 		$(dgsjArr).each(function(i,item){
	 			DGSj+=(item);
	 		});
	 		var DGTr = '<tr><td>代管费</td><td>'+payDg+'</td><td>'+DGSj+'</td>';
	 		DGTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		DGTr+='<option value="Xj-'+(xjKind.dg)+'">现金</option>';
	 		DGTr+='<option value="Sk-'+(skKind.dg)+'">刷卡</option>';
	 		DGTr+='<option value="Zp-'+(zpKind.dg)+'">支票</option>';
	 		DGTr+='<option value="Weixin-'+(weixinKind.dg)+'">汇款-微信</option>';
	 		DGTr+='<option value="Zfb-'+(zfbKind.dg)+'">汇款-支付宝</option>';
	 		DGTr+='<option value="Wl-'+(wlKind.dg)+'">汇款-网络</option>';
	 		DGTr+='<option value="Zz-'+(zzKind.dg)+'">银行转账</option>';
	 		DGTr+='<option value="Fq-'+(fqKind.dg)+'">分期</option>';
	 		DGTr+='</select></div>';
	 		DGTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(xjKind.dg)+'"></div></div>';
	 		DGTr+='</td><td>'+(payDg-DGSj)+'</td></tr>'; 
	 		
	 		var FDSj=payFd;
	 		var FDTr = '<tr><td>辅导费</td><td>'+payFd+'</td><td>'+FDSj+'</td>';
	 		FDTr+='<td><div class="payment"><div class="col-sm-4"><select class="form-control">';
	 		FDTr+='<option value="jf-'+FDSj+'">缴费</option>';
	 		FDTr+='</select></div>';
	 		FDTr+='<div class="col-sm-5"><input disabled class="form-control"type="text" value="'+(FDSj)+'"></div></div>';
	 		FDTr+='</td><td>'+(payFd-FDSj)+'</td></tr>'; 
	 		
	 		var ZJTr = '<tr><td>总计</td><td>'+(payXz+payKs+payZl+payDg+payJc+payFd)+'</td>';
	 		ZJTr+='<td>'+(XZSj+KSSj+ZLSj+DGSj+JCSj+FDSj)+'</td><td></td><td></td></tr>';
	 		var YHTr='<tr><td>优惠券</td><td>'+payY+'</td><td></td><td></td><td></td></tr>';
	 		var ZKTr='<tr><td>折扣</td><td>'+payZk+'</td><td></td><td></td><td></td></tr>';
	 		var HJTr = '<tr><td>合计</td><td>'+(payXz+payKs+payZl+payDg+payJc+payFd-payY-payZk)+'</td>';
	 		HJTr+='<td>'+(XZSj+KSSj+ZLSj+DGSj+JCSj+FDSj)+'</td><td></td>';
	 		HJTr+='<td>'+(payXz+payKs+payZl+payDg+payJc+payFd-payY-payZk-(XZSj+KSSj+ZLSj+DGSj+JCSj+FDSj))+'</td></tr>';
	 		var thead='<thead><tr><th>收费项目</th><th>应缴</th><th>实缴</th><th>支付方式</th><th>欠费</th></tr></thead>';
	 		$('#payMentTableInfo').append(thead+XZTr+KSTr+ZLTr+JCTr+DGTr+FDTr+ZJTr+YHTr+ZKTr+HJTr);
	 	}
	 	
	 	$('#payMentTableInfo').on('change','select',function(){
	 		var paymoney = $(this).val().split('-')[1];
	 		$(this).parent().parent().parent().parent().find('input').val(paymoney);
	 		
	 	})
	 
	 /**
	  * 回调函数
	  * @param sSource
	  * @param aoData
	  * @param fnCallback
	  * @returns
	  */
	 function retrieveData( sSource, aoData, fnCallback, oSettings ) {
	     var searchVal = $('#searchVal').val();
	     if(searchVal && searchVal.length != 0){
	     	aoData.push({ "name": "searchVal", "value": searchVal.trim() });
	     }
	     aoData.push( { "name": "pageNum", "value": (Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength )+1) });
	     aoData.push( { "name": "pageSize", "value": oSettings._iDisplayLength });  
	     $.ajax( {  
	         "url": sSource,  
	         "data": aoData,  
	         "cache": false,  
	         "dataType": 'json', 
	         "type": "POST", 
	         "success" :function(response) {
	         	fnCallback(response.returnObject);
	         }  
	     } );  
	 }
	 	
	 	//初始化分校校区select 
	 	function initSchoolArea(record){
	 		$.ajax({
		        url: ctx + '/department/getAllOption',
		        type: 'POST',
		        data: {parentId : record.departmentId1},
		        dataType: 'json',
		        success: function (data) {
		    		var opt = "";
		        	for(var i=0; i<data.list.length; i++){
		        		opt += "<option address="+data.list[i].description+" value="+data.list[i].departmentId+">" + data.list[i].fullName+ "</option>";
		        	}
		        	$("#schoolIdModelMsg").html('<option value="-1">--请选择--</option>'+opt);
		        },
		        error: function (response) {
		        	toastr.error("系统错误");
		        }
		    });
	 	}
	 	function statusRecord(){
	 		return {ycj:{status:0,record:new Array(),name:'已创建'},dgt:{status:0,record:new Array(),name:'待沟通'},ygt:{status:0,record:new Array(),name:'已沟通'},yu:{status:0,record:new Array(),name:'预约'},sm:{status:0,record:new Array(),name:'上门'},dz:{status:0,record:new Array(),name:'订座'},bm:{status:0,record:new Array(),name:'报名'},hf:new Array()};
	 	}
	 	
		//加载记录
	 	function loadConsultRecord(consultInfo){
	 		var stusRecord = new statusRecord(); 
	 		var infoManageId = consultInfo.infoManageId;
	 		$('#Dynamicrecord input[infoManageId]').val(infoManageId);
	 		$.ajax({  
	 			   type: "POST",  
	 			   url: ctx + "/consultInfoManageServer/getRecordByInfoManageId/82d0c90e-d434-4821-a784-1a91a237c2c4",  
	 			   dataType: 'json',  
	 			   success: function(data){
	 				   if(data.list.length>0){
	 					   $(data.list).each(function(i,item){
	 						   if(item.status=='1'){
	 							  stusRecord.ycj.status=1;
	 							  stusRecord.ycj.record.push(item);
	 						   }else if(item.status=='2'){
	 							  stusRecord.dgt.status=1;
	 							  stusRecord.dgt.record.push(item);
	 						   }else if(item.status=='3'){
	 							  stusRecord.ygt.status=1;
	 							  stusRecord.ygt.record.push(item);
	 						   }else if(item.status=='4'){
	 							 stusRecord.yu.status=1;
	 							 stusRecord.yu.record.push(item);
	 						   }else if(item.status=='5'){
	 							  stusRecord.sm.status=1;
		 						  stusRecord.sm.record.push(item);
	 						   }else if(item.status=='6'){
	 							  stusRecord.dz.status=1;
		 						  stusRecord.dz.record.push(item);
	 						   }else if(item.status=='7'){
	 							  stusRecord.bm.status=1;
		 						  stusRecord.bm.record.push(item);
	 						   }else if(item.status=='20'){
		 						  stusRecord.hf.push(item);
	 						   }
	 					   });
	 					   $('#Allofthedynamic').html('');
	 					   var dynamicHtml='';
	 					   for(var key in stusRecord){
	 						   if(key=='hf'||stusRecord[key].status==1){
	 							  dynamicHtml+=recordHtml(consultInfo,stusRecord,'',key);
	 						   }
	 					   }
	 					  $('#Allofthedynamic').html(dynamicHtml);
	 				   }
	 				   
	 			   },
	 			   error:function(msg){
	 				  toastr.error('系统错误');
	 			   }
	 			});
	 	}
	 	//记录html
	 	function recordHtml(consultInfo,stusRecord,dynamicHtml,identifyStr){
	 		  dynamicHtml+='<div class="media"><a class="pull-left DynamicImage" href="#">';
			  dynamicHtml+='<img src="'+ctx_static+'/home/serviceCenter/image/head.jpg" alt=""></a>';
			  
			  dynamicHtml+='<div class="media-body media-wen">';
			  dynamicHtml+='<div class="media-body-content"><h4 class="media-heading">';
			  if(identifyStr=='hf'){
				  dynamicHtml+='<span class="pull-left dynamic-head-left">'+stusRecord.hf[stusRecord.hf.length-1].createUserName+'</span>';
				  dynamicHtml+='<a href="#" class="pull-right dynamic-head-right">网站客服记录</a>';
			  }else{
				  dynamicHtml+='<span class="pull-left dynamic-head-left">'+stusRecord[identifyStr].record[0].createUserName+'</span>';
			  	  dynamicHtml+='<a href="#" class="pull-right dynamic-head-right">客户阶段</a>';
			  }
			  dynamicHtml+='</h4>';
			  if(identifyStr=='ycj'){
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+'已创建'+'</span>';
			  }else if(identifyStr=='dgt'){
				  if(stusRecord.ycj.status==1){
					  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+'已创建'+'</span>';  
					  dynamicHtml+='<span class="glyphicon glyphicon-arrow-right"></span>';
					  dynamicHtml+='<span class="dynamic-content1-right">待沟通</span>';
				  }
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+'待沟通'+'</span>';
			  }else if(identifyStr=='ygt'){
				  var previosStr =stusRecord.dgt.status==1?'dgt':null;
				  if(previosStr==null){
					  previosStr = previousStatusStr(stusRecord,'ygt','dgt');
				  }
				  if(previosStr!=''){
					  var concatStr='已沟通(未预约)';
					  if(consultInfo.serverDropFalse=='1')concatStr='已沟通(已预约未上门)';
					  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+stusRecord[previosStr].name+'</span>';  
					  dynamicHtml+='<span class="glyphicon glyphicon-arrow-right"></span>';
					  dynamicHtml+='<span class="dynamic-content1-right">'+concatStr+'</span>';
				  }
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+concatStr+'</span>';
			  }else if(identifyStr=='yu'){
				  var previosStr =stusRecord.ygt.status==1?'ygt':null;
				  if(previosStr==null){
					  previosStr = previousStatusStr(stusRecord,'yu','ygt');
				  }
				  if(previosStr!=''){
					  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+stusRecord[previosStr].name+'</span>';  
					  dynamicHtml+='<span class="glyphicon glyphicon-arrow-right"></span>';
					  dynamicHtml+='<span class="dynamic-content1-right">已预约</span>';
				  }
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">已预约</span>';
			  }else if(identifyStr=='sm'){
				  var previosStr =stusRecord.yu.status==1?'yu':null;
				  if(previosStr==null){
					  previosStr = previousStatusStr(stusRecord,'sm','yu');
				  }
				  if(previosStr!=''){
					  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+stusRecord[previosStr].name+'</span>';  
					  dynamicHtml+='<span class="glyphicon glyphicon-arrow-right"></span>';
					  dynamicHtml+='<span class="dynamic-content1-right">已上门</span>';
				  }
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">已上门</span>';
			  }else if(identifyStr=='dz'){
				  var previosStr =stusRecord.dgt.status==1?'dz':null;
				  if(previosStr==null){
					  previosStr = previousStatusStr(stusRecord,'dz','sm');
				  }
				  if(previosStr!=''){
					  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+stusRecord[previosStr].name+'</span>';  
					  dynamicHtml+='<span class="glyphicon glyphicon-arrow-right"></span>';
					  dynamicHtml+='<span class="dynamic-content1-right">已订座</span>';
				  }
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">已订座</span>';
			  }else if(identifyStr=='bm'){
				  var previosStr =stusRecord.dgt.status==1?'dgt':null;
				  if(previosStr==null){
					  previosStr = previousStatusStr(stusRecord,'bm','dz');
				  }
				  if(previosStr!=''){
					  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">'+stusRecord[previosStr].name+'</span>';  
					  dynamicHtml+='<span class="glyphicon glyphicon-arrow-right"></span>';
					  dynamicHtml+='<span class="dynamic-content1-right">已报名</span>';
				  }
				  dynamicHtml+='<p style="clear: both" class="dynamic-content"><span class="dynamic-content1-left">已报名</span>';
			  }else if (identifyStr=='hf'){
				  dynamicHtml+='<p style="clear: both" class="dynamic-content">';
				  dynamicHtml+='<p class="media-talk"><a href="#" class="glyphicon glyphicon-headphones media-headphones"></a>通过网站客服与客户进行了会话';
				  dynamicHtml+='<span class="talk-right" onclick="togleInfo(this);"><a href="#"class="glyphicon glyphicon-eye-open"></a>查看聊天记录</span>';
				  dynamicHtml+='<div style="display:block;" class="recordKF">';
				  $(stusRecord.hf).each(function(i,item){
					  dynamicHtml+='<p><strong>'+item.content+'</strong></p>';
				  });
				  dynamicHtml+='</div></p>';
			  }
			  if(identifyStr!='hf'){
				  $(stusRecord[identifyStr].record).each(function(i,item){
					  if(item.status==4){
						  var conJson = null;
						  try{
							  conJson=JSON.parse(item.content);
						  }catch(e){console.log('转换异常')}
						  dynamicHtml+='<p><strong>'+(conJson?(conJson.subscribeDate+" "+conJson.schoolName):item.content)+'</strong></p>'
					  }else{
						  dynamicHtml+='<p><strong>'+item.content+'</strong></p>'
					  }
				  });
				  dynamicHtml+='</p>';
			  }
			 if(identifyStr=='hf'){
				 dynamicHtml+='<span class="media-footer">'+stusRecord.hf[stusRecord.hf.length-1].createDate+'</span>';
			 }else{
				 dynamicHtml+='<span class="media-footer">'+stusRecord[identifyStr].record[0].createDate+'</span>';
			 }
			 dynamicHtml+='</div></div></div>';
			 return dynamicHtml;
	 	}
	 	//前一个状态
	 	function previousStatusStr(stusRecord,currentStr,previousStr){
	 		 var  previosStr='';
			  for(var key in stusRecord){
				  if(key==previousStr){
					  break;
				  }
				  if(stusRecord[key].status==1){
					  previosStr+=key+","
				  }
			  }
			  if(previosStr!=''){
				  var keyArr=previosStr.split(",")
				  previosStr =keyArr[keyArr.length-2]; 
			  } 
			  return previosStr;
	 	}
	 	//动态记录添加
	 	$('#Dynamicrecord .Confirmtoadd').on('click',function(){
 		  /*$.ajax({  
	 			   type: "POST",  
	 			   url: ctx + "/consultInfoManageServer/addNewRecord",  
	 			   data: {
	 				  content:(moment().format('YYYY-MM-DD HH:mm:ss')+':'+$('#Dynamicrecord textarea[name=content]').val()),
	 				  infoManageId:$('#Dynamicrecord input[infoManageId]').val(),
	 				  status:'20'
	 			   },  
	 			   dataType: 'json',  
	 			   success: function(msg){
	 			   		toastr.success('添加成功');
	 			   }  
		   });*/
	 	});
		 //发送短信
	    $('#MsgForm').bootstrapValidator({
	        message: 'This value is not valid',
	        feedbackIcons: {
	            valid: 'glyphicon glyphicon-ok',
	            invalid: 'glyphicon glyphicon-remove',
	            validating: 'glyphicon glyphicon-refresh'
	        },
	        fields: {//表单验证
	        	studentPhoneMsg: {
	                validators: {
	                    notEmpty: {
	                        message: '手机号不能为空'
	                    }
	                }
	            },
	            showPhoneMsg: {
	                validators: {
	                    notEmpty: {
	                        message: '消息内容不能为空'
	                    }
	                }
	            },
	            schoolIdModelMsg:{
	            	 validators: {
	            		 callback: {  
	                         message: '选选择预约校区',  
	                         callback: function(value,validator){
	                        	 return !(value=='-1');
	                         	}
	                        }  
		               }
	            }
	        },
	        submitHandler: function (validator, form, submitButton) {
	        	$.ajax({  
		 			   type: "POST",  
		 			   url: ctx + "/consultConsole/sendMsg",  
		 			   data: {
		 				  moblie:$('#studentPhoneMsg').val(),
		 				  msg:$('#showPhoneMsg').val()
		 			   },  
		 			   dataType: 'json',  
		 			   success: function(msg){
		 				   msg = JSON.parse(msg.msg); 
		 				   toastr.success(msg.msg);
		 				   $('#shortMsgModal').modal('hide');
		 			   }  
		 			});
	            return false;
	        }
	    });
	 	
	 	/**
	 	 * 短信类型区分
	 	 * @returns
	 	 */
	 	$('#msgContent').on('change',function(){
	 		var val = $(this).val();
	 		val = val.replace('class',$('#classId2').find('option:selected').text());
	 		val = val.replace('address',$('#schoolIdModelMsg').find('option:selected').attr('address'));
	 		$('#showPhoneMsg').val(val)
	 	});
/*------------------------------------分割线--------------------------------------------------*/
    $.fn.myScroll = function (options) {
        var defaults = {
            speed: 40,
            rowHeight: 24
        };
        var opts = $.extend({}, defaults, options),
            intId = [];

        function marquee(obj, step) {
            obj.find("ul").animate({
                marginTop: '-=1'
            }, 0, function () {
                var s = Math.abs(parseInt($(this).css("margin-top")));
                if (s >= step) {
                    $(this).find("li").slice(0, 1).appendTo($(this));
                    $(this).css("margin-top", -5);
                }
            });
        }

        this.each(function (i) {
            var sh = opts["rowHeight"],
                speed = opts["speed"],
                _this = $(this);
            intId[i] = setInterval(function () {
                if (_this.find("ul").height() <= _this.height()) {
                    clearInterval(intId[i]);
                } else {
                    marquee(_this, sh);
                }
            }, speed);

            _this.hover(function () {
                clearInterval(intId[i]);
            }, function () {
                intId[i] = setInterval(function () {
                    if (_this.find("ul").height() <= _this.height()) {
                        clearInterval(intId[i]);
                    } else {
                        marquee(_this, sh);
                    }
                }, speed);
            });

        });
    }

//优惠
$(".benefit").click(function () {
    if (this.checked) {
        $(this).parents().find(".youhui").css({
            "display": "block"
        })
    } else {
        $(this).parents().find(".youhui").css({
            "display": "none"
        })
    }

})

$(".benefit_ma").click(function () {
    if (this.checked) {
        $(this).parents().find(".youhuima").css({
            "display": "block"
        })
    } else {
        $(this).parents().find(".youhuima").css({
            "display": "none"
        })
    }

})

$(".fenxiao").click(function () {
    if (this.checked) {
        $(this).parents().find(".fenxiao_content").css({
            "display": "block"
        })
    } else {
        $(this).parents().find(".fenxiao_content").css({
            "display": "none"
        })
    }

})


//缴费
$(".add_row").click(function () {
    var add_content = '<div  class="row clear_both form_margin">' +
        '<div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12">' +
        '<select class="col-lg-12 col-md-12 col-sm-12 col-xs-12">' +
        '<option>现金</option>' +
        '<option>刷卡</option>' +
        '<option>汇款-支付宝</option>' +
        '</select>' +
        '</div>' +
        '<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">' +
        '<input class="form-control" type="text">' +
        '</div>' +
        '<a href="javascript:void(0);" class="btn btn-info btn-xs  minus_row"><i class="fa fa-minus-circle"></i></a>' +
        '</div>';
    $(this).parent().first().after(add_content);
    //删除新增信息
    $(".minus_row").click(function () {
        $(this).parent().remove();
    })
})
//显示隐藏
$(".hide_content").click(function () {
    $(this).siblings().toggle();
})

$(".add_jiaofei").click(function () {
    $(".bs-example-modal-lg3").css({"z-index": "1038"})
})
$(".close_jf").click(function () {

    $(".bs-example-modal-lg3").css({"z-index": "1042"}).find(".modal-backdrop.in").css({"opacity": "0"})
})

$(".cancel").click(function () {

    $(".bs-example-modal-lg3").css({"z-index": "1042"}).find(".modal-backdrop.in").css({"opacity": "0"})
})

//右侧按钮

$(".yidong").hover(function () {
    $(this).find("ul").fadeIn(500)
}, function () {
    $(this).find("ul").fadeOut(500)
})

//编辑
$(".btn_special_edit").click(function () {
    $(this).parent().parent().parent().parent().find(".comment_disabled").attr({"disabled": false})
})
$(".collapse-btn").click(function () {
    $(this).parent().parent().siblings().toggle();
})

//呼出、查看信息编辑按钮
$(".call-out").click(function () {
    $('.btn_special_edit').hide().parents().find(".comment_disabled").attr({"disabled": false});
})
$(".ck").click(function () {
    $('.btn_special_edit').show().parents().find(".comment_disabled").attr({"disabled": "disabled"});
})

//点击下一步
$(".pre-step").show();
$(".nex-step").hide();
$(".next-step").on("click", function () {
    $(".pre-step").hide();
    $(".nex-step").show();
})
$(".prev-step").on("click", function () {
    $(".pre-step").show();
    $(".nex-step").hide();
})
//日期
$('.date-picker').datepicker({
    language: 'zh-CN',
    format: 'yyyy-mm-dd'
}).on('changeDate', function () {
    $(this).datepicker('hide');
});

function showMask() {
    $("#mask").css("height", $(document).height());
    $("#mask").css("width", $(document).width());
    $("#mask").show();
}

//点击弹出
$(".amplification").on("click", function () {
    var w=$(this).parent().find("img").width(),h=$(this).parent().find("img").height();
    $(".mask-content").css("position","relative");
    var bigpic=$(this).parent().find("img").clone().css({
        "-webkit-transform": "scale(2)",
        "-webkit-transition": "all 1s",
        "position": "absolute",
        "top": "50%",
        "left": "50%",
        "margin-left": -w / 2,
        "margin-top": h / 2,
        "z-index": "999999 !important"
    })
    $(".mask-content").html(bigpic);
})
    //遮罩层
    $('.bs-example-modal-lg4,.TurnClass,.Outofschool,.information').on('show.bs.modal', function () {
        $('.bphone').css('z-index', 1039);
    }).on('hide.bs.modal', function () {
        $('.bphone').css('z-index', 1050);
    })
})(jQuery);

function togleInfo(spanObj){
		var divRecord = $(spanObj).parent().next();
		divRecord.css('display',divRecord.is(":hidden")?'block':'none');
	}

$(".refund_tuifei").click(function() {
	$(".bphone").css({
		"z-index": "10"
	});
	$(".refund").css({
		"z-index": "1060"
	})
})
$(".refund .close").click(function() {
	$(".bphone").css({
		"z-index": "1050"
	});
	$(".refund").css({
		"z-index": "1040"
	})
})

//固定按钮切换
$('.right-toolbar>li>a,.right-toolbar>li>ul>li>a').hover(function () {
        $(this).find('.up').stop().fadeIn(400);
	},function () {
        $(this).find('.up').stop().fadeOut(400);
})
$('.operation,.right-toolbar>li>ul>li>a').hover(function () {
     	$('.right-toolbar>li>ul').stop().fadeIn(400);
    },function () {
    	$('.right-toolbar>li>ul').stop().fadeOut(400);
})


//回车搜索
function search(){
	if(event.keyCode==13){
		DataTable.init();
	}
}